Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 101   Methods: 2
NCLOC: 52   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ServerSideWsGenerator.java 25% 72% 100% 67.7%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 package org.apache.geronimo.ews.ws4j2ee.toWs.ws;
 17   
 
 18   
 import org.apache.axis.wsdl.symbolTable.SymbolTable;
 19   
 import org.apache.commons.logging.Log;
 20   
 import org.apache.commons.logging.LogFactory;
 21   
 import org.apache.geronimo.ews.jaxrpcmapping.J2eeEmitter;
 22   
 import org.apache.geronimo.ews.jaxrpcmapping.JaxRpcMapper;
 23   
 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
 24   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
 25   
 import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
 26   
 import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeFactory;
 27   
 
 28   
 /**
 29   
  * <p>This genarated the Server side SEI and other classes required in the
 30   
  * Axis.</p>
 31   
  * <h3>Service Endpoint Interface</h3>
 32   
  * <p>The JAX-RPC specification requires that a JAX-RPC service endpoint interface must
 33   
  * follow the following rules:</p>
 34   
  * <ol>
 35   
  * <li>Service endpoint interface must extend java.rmi.Remote either directly or indirectly</li>
 36   
  * <li>All methods in the interface must throw java.rmi.RemoteException. Methods may
 37   
  * throw service specific exceptions in addition to the RemoteException.</li>
 38   
  * <li>Method parameters and return types must be the JAX-RPC supported Java types
 39   
  * (refer to the section 5.1, ���JAX-RPC Supported Java Types���). At runtime, values of a
 40   
  * supported Java type must be serializable to and from the corresponding XML
 41   
  * representation.
 42   
  * </li>
 43   
  * <li>Holder classes may be used as method parameters. These Holder classes are either
 44   
  * generated or those packaged in the standard javax.xml.rpc.holders package.</li>
 45   
  * <li>Service endpoint interface must not include constant (as public final static)
 46   
  * declarations. WSDL 1.1 specification does not define any standard representation for
 47   
  * constants in a wsdl:portType definition.</li>
 48   
  * </ol>
 49   
  *
 50   
  * @author Srinath Perera(hemapani@opensource.lk)
 51   
  */
 52   
 public class ServerSideWsGenerator implements Generator {
 53   
     private J2EEWebServiceContext j2eewscontext;
 54   
     private Ws4J2eeFactory factory;
 55   
     protected static Log log =
 56   
             LogFactory.getLog(ServerSideWsGenerator.class.getName());
 57   
 
 58  11
     public ServerSideWsGenerator(J2EEWebServiceContext j2eewscontext) {
 59  11
         this.j2eewscontext = j2eewscontext;
 60  11
         factory = j2eewscontext.getFactory();
 61   
     }
 62   
 
 63  11
     public void generate() throws GenerationFault {
 64  11
         try {
 65  11
             String mappingfile =
 66   
                     j2eewscontext.getMiscInfo().getJaxrpcfile().fileName();
 67  11
             String wsdlfile =
 68   
                     j2eewscontext.getMiscInfo().getWsdlFile().fileName();
 69   
             
 70   
 //            J2eeEmitter j2ee = new J2eeEmitter(true,
 71   
 //                !j2eewscontext.getMiscInfo().isSEIExists(),j2eewscontext);
 72  11
             J2eeGeneratorFactory genFac = new J2eeGeneratorFactory();
 73  11
             J2eeEmitter j2ee = new J2eeEmitter(j2eewscontext, genFac);
 74  11
             if (j2eewscontext.getMiscInfo().isVerbose()) {
 75  0
                 log.info("wsdl file = " + wsdlfile);
 76  0
                 log.info("jaxrpc mapping file = " + mappingfile);
 77  0
                 log.info("calling the jaxrpcmapper >> ");
 78   
             }
 79  11
             j2ee.setMappingFilePath(mappingfile);
 80  11
             j2ee.setOutputDir(j2eewscontext.getMiscInfo().getOutPutPath());
 81  11
             j2ee.setServerSide(true);
 82  11
             j2ee.setVerbose(j2eewscontext.getMiscInfo().isVerbose());
 83   
             //j2ee.setUsedbyws4j2ee(true);
 84  11
             j2ee.setHelperWanted(true);
 85  11
             j2ee.runServerSide(wsdlfile);
 86  11
             SymbolTable axisSymboltable = j2ee.getSymbolTable();
 87  11
             j2eewscontext.setWSDLContext(factory.getContextFactory().createWSDLContext(axisSymboltable));
 88  11
             JaxRpcMapper mapper = j2ee.getJaxRpcMapper();
 89  11
             j2eewscontext.setJAXRPCMappingContext(factory.getContextFactory().createJaxRpcMapperContext(mapper, j2ee));
 90   
         } catch (Exception e) {
 91  0
             if (e instanceof RuntimeException) {
 92  0
                 throw (RuntimeException) e;
 93   
             } else {
 94  0
                 e.printStackTrace();
 95  0
                 throw GenerationFault.createGenerationFault(e);
 96   
             }
 97   
         }
 98   
     }
 99   
 
 100   
 }
 101